home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-24 | 20.5 KB | 685 lines | [TEXT/MPS ] |
- ;
- ; File: Controls.a
- ;
- ; Contains: Control Manager interfaces
- ;
- ; Version: Technology: System 7.5
- ; Package: Universal Interfaces 2.2 in “MPW” on ETO #20
- ;
- ; Copyright: © 1984-1995 by Apple Computer, Inc.
- ; All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- ; stack. Include the file and version information (from above)
- ; in the problem description and send to:
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
-
- IF &TYPE('__CONTROLS__') = 'UNDEFINED' THEN
- __CONTROLS__ SET 1
-
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- ; include 'ConditionalMacros.a' ;
-
- IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
- include 'Quickdraw.a'
- ENDIF
- ; include 'MixedMode.a' ;
- ; include 'QuickdrawText.a' ;
-
- IF &TYPE('__MENUS__') = 'UNDEFINED' THEN
- include 'Menus.a'
- ENDIF
- ; include 'Memory.a' ;
- IF &TYPE('STRICT_CONTROLS') = 'UNDEFINED' THEN
- STRICT_CONTROLS: SET 0
- ENDIF
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL DEFINITION ID'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; Standard System 7 procID's for use only with NewControl()
- ;
-
- pushButProc EQU 0
- checkBoxProc EQU 1
- radioButProc EQU 2
- scrollBarProc EQU 16
- popupMenuProc EQU 1008
-
- kControlUsesOwningWindowsFontVariant EQU 1 << 3 ; Control uses owning windows font to display text
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL PART CODES
- ;
- ;_________________________________________________________________________________________________________
- ; typedef SInt16 ControlPartCode
-
- kControlNoPart EQU 0
- kControlLabelPart EQU 1
- kControlMenuPart EQU 2
- kControlTrianglePart EQU 4
- kControlButtonPart EQU 10
- kControlCheckBoxPart EQU 11
- kControlRadioButtonPart EQU 11
- kControlUpButtonPart EQU 20
- kControlDownButtonPart EQU 21
- kControlPageUpPart EQU 22
- kControlPageDownPart EQU 23
- kControlIndicatorPart EQU 129
- kControlDisabledPart EQU 254
- kControlInactivePart EQU 255
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CHECK BOX VALUES
- ;
- ;_________________________________________________________________________________________________________
- kControlCheckboxUncheckedValue EQU 0
- kControlCheckboxCheckedValue EQU 1
- kControlCheckboxMixedValue EQU 2
-
- ;_________________________________________________________________________________________________________
- ;
- ; • RADIO BUTTON VALUES
- ;
- ;_________________________________________________________________________________________________________
- kControlRadioButtonUncheckedValue EQU 0
- kControlRadioButtonCheckedValue EQU 1
- kControlRadioButtonMixedValue EQU 2
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL POP-UP MENU CONSTANTS
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; Variant codes for the System 7 pop-up menu
- ;
- popupFixedWidth EQU 1 << 0
- popupVariableWidth EQU 1 << 1
- popupUseAddResMenu EQU 1 << 2
- popupUseWFont EQU 1 << 3
-
- ;
- ; Menu label styles for the System 7 pop-up menu
- ;
- popupTitleBold EQU 1 << 8
- popupTitleItalic EQU 1 << 9
- popupTitleUnderline EQU 1 << 10
- popupTitleOutline EQU 1 << 11
- popupTitleShadow EQU 1 << 12
- popupTitleCondense EQU 1 << 13
- popupTitleExtend EQU 1 << 14
- popupTitleNoStyle EQU 1 << 15
-
- ;
- ; Menu label justifications for the System 7 pop-up menu
- ;
- popupTitleLeftJust EQU $00000000
- popupTitleCenterJust EQU $00000001
- popupTitleRightJust EQU $000000FF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL DRAGGRAYRGN CONSTANTS
- ;
- ; For DragGrayRgnUPP used in TrackControl()
- ;
- ;_________________________________________________________________________________________________________
- noConstraint EQU kNoConstraint
- hAxisOnly EQU 1
- vAxisOnly EQU 2
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL COLOR TABLE PART CODES
- ;
- ;_________________________________________________________________________________________________________
- cFrameColor EQU 0
- cBodyColor EQU 1
- cTextColor EQU 2
- cThumbColor EQU 3
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL TYPE DECLARATIONS
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; Define ControlRef and ControlHandle
- ;
- IF STRICT_CONTROLS THEN
- ; typedef ControlRef ControlHandle
- ELSE
- ; typedef struct ControlRecord ControlRecord, *ControlPtr, **ControlHandle
- ; typedef ControlHandle ControlRef
- ENDIF
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL ACTIONPROC POINTER
- ;
- ;_________________________________________________________________________________________________________
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL COLOR TABLE STRUCTURE
- ;
- ;_________________________________________________________________________________________________________
- CtlCTab RECORD 0
- ccSeed ds.l 1 ; offset: $0 (0)
- ccRider ds.w 1 ; offset: $4 (4)
- ctSize ds.w 1 ; offset: $6 (6)
- ctTable ds.b 4 * ColorSpec.sizeof ; offset: $8 (8)
- sizeof EQU * ; size: $28 (40)
- ENDR
-
- ; typedef struct CtlCTab CtlCTab
- ; typedef CtlCTab *CCTabPtr, **CCTabHandle
- IF ¬ STRICT_CONTROLS THEN
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL RECORD STRUCTURE
- ;
- ;_________________________________________________________________________________________________________
- ControlRecord RECORD 0
- nextControl ds.l 1 ; offset: $0 (0)
- contrlOwner ds.l 1 ; offset: $4 (4)
- contrlRect ds Rect ; offset: $8 (8)
- contrlVis ds.b 1 ; offset: $10 (16)
- contrlHilite ds.b 1 ; offset: $11 (17)
- contrlValue ds.w 1 ; offset: $12 (18)
- contrlMin ds.w 1 ; offset: $14 (20)
- contrlMax ds.w 1 ; offset: $16 (22)
- contrlDefProc ds.l 1 ; offset: $18 (24)
- contrlData ds.l 1 ; offset: $1C (28)
- contrlAction ds.l 1 ; offset: $20 (32)
- contrlRfCon ds.l 1 ; offset: $24 (36)
- contrlTitle ds.l 64 ; offset: $28 (40)
- sizeof EQU * ; size: $128 (296)
- ENDR
-
- ;_________________________________________________________________________________________________________
- ;
- ; • AUXILLARY CONTROL RECORD STRUCTURE
- ;
- ;_________________________________________________________________________________________________________
- AuxCtlRec RECORD 0
- acNext ds.l 1 ; offset: $0 (0)
- acOwner ds.l 1 ; offset: $4 (4)
- acCTable ds.l 1 ; offset: $8 (8)
- acFlags ds.w 1 ; offset: $C (12)
- acReserved ds.l 1 ; offset: $E (14)
- acRefCon ds.l 1 ; offset: $12 (18)
- sizeof EQU * ; size: $16 (22)
- ENDR
-
- ; typedef struct AuxCtlRec AuxCtlRec
- ; typedef AuxCtlRec *AuxCtlPtr, **AuxCtlHandle
- ;_________________________________________________________________________________________________________
- ;
- ; • POP-UP MENU PRIVATE DATA STRUCTURE
- ;
- ;_________________________________________________________________________________________________________
- PopupPrivateData RECORD 0
- mHandle ds.l 1 ; offset: $0 (0)
- mID ds.w 1 ; offset: $4 (4)
- sizeof EQU * ; size: $6 (6)
- ENDR
-
- ; typedef struct PopupPrivateData PopupPrivateData
- ; typedef PopupPrivateData *PopupPrivateDataPtr, **PopupPrivateDataHandle
- ENDIF
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL CREATION / DELETION API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal ControlRef NewControl(WindowRef theWindow, const Rect *boundsRect, ConstStr255Param title, Boolean visible, SInt16 value, SInt16 min, SInt16 max, SInt16 procID, SInt32 refCon)
- ;
- IF ¬ GENERATINGCFM THEN
- _NewControl: OPWORD $A954
- ELSE
- IMPORT_CFM_FUNCTION NewControl
- ENDIF
-
- ;
- ; pascal ControlRef GetNewControl(SInt16 controlID, WindowRef owner)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetNewControl: OPWORD $A9BE
- ELSE
- IMPORT_CFM_FUNCTION GetNewControl
- ENDIF
-
- ;
- ; pascal void DisposeControl(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _DisposeControl: OPWORD $A955
- ELSE
- IMPORT_CFM_FUNCTION DisposeControl
- ENDIF
-
- ;
- ; pascal void KillControls(WindowRef theWindow)
- ;
- IF ¬ GENERATINGCFM THEN
- _KillControls: OPWORD $A956
- ELSE
- IMPORT_CFM_FUNCTION KillControls
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL SHOWING/HIDING API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal void ShowControl(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _ShowControl: OPWORD $A957
- ELSE
- IMPORT_CFM_FUNCTION ShowControl
- ENDIF
-
- ;
- ; pascal void HideControl(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _HideControl: OPWORD $A958
- ELSE
- IMPORT_CFM_FUNCTION HideControl
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL DRAWING API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal void DrawControls(WindowRef theWindow)
- ;
- IF ¬ GENERATINGCFM THEN
- _DrawControls: OPWORD $A969
- ELSE
- IMPORT_CFM_FUNCTION DrawControls
- ENDIF
-
- ;
- ; pascal void Draw1Control(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _Draw1Control: OPWORD $A96D
- ELSE
- IMPORT_CFM_FUNCTION Draw1Control
- ENDIF
-
- ;
- ; pascal void UpdateControls(WindowRef theWindow, RgnHandle updateRegion)
- ;
- IF ¬ GENERATINGCFM THEN
- _UpdateControls: OPWORD $A953
- ELSE
- IMPORT_CFM_FUNCTION UpdateControls
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL HIGHLIGHT API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal void HiliteControl(ControlRef theControl, ControlPartCode hiliteState)
- ;
- IF ¬ GENERATINGCFM THEN
- _HiliteControl: OPWORD $A95D
- ELSE
- IMPORT_CFM_FUNCTION HiliteControl
- ENDIF
-
- ;
- ; pascal ControlPartCode TrackControl(ControlRef theControl, Point thePoint, ControlActionUPP actionProc)
- ;
- IF ¬ GENERATINGCFM THEN
- _TrackControl: OPWORD $A968
- ELSE
- IMPORT_CFM_FUNCTION TrackControl
- ENDIF
-
- ;
- ; pascal void DragControl(ControlRef theControl, Point startPoint, const Rect *limitRect, const Rect *slopRect, DragConstraint axis)
- ;
- IF ¬ GENERATINGCFM THEN
- _DragControl: OPWORD $A967
- ELSE
- IMPORT_CFM_FUNCTION DragControl
- ENDIF
-
- ;
- ; pascal ControlPartCode TestControl(ControlRef theControl, Point thePoint)
- ;
- IF ¬ GENERATINGCFM THEN
- _TestControl: OPWORD $A966
- ELSE
- IMPORT_CFM_FUNCTION TestControl
- ENDIF
-
- ;
- ; pascal ControlPartCode FindControl(Point thePoint, WindowRef theWindow, ControlRef *theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _FindControl: OPWORD $A96C
- ELSE
- IMPORT_CFM_FUNCTION FindControl
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL MOVING/SIZING API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal void MoveControl(ControlRef theControl, SInt16 h, SInt16 v)
- ;
- IF ¬ GENERATINGCFM THEN
- _MoveControl: OPWORD $A959
- ELSE
- IMPORT_CFM_FUNCTION MoveControl
- ENDIF
-
- ;
- ; pascal void SizeControl(ControlRef theControl, SInt16 w, SInt16 h)
- ;
- IF ¬ GENERATINGCFM THEN
- _SizeControl: OPWORD $A95C
- ELSE
- IMPORT_CFM_FUNCTION SizeControl
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL TITLE API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal void SetControlTitle(ControlRef theControl, ConstStr255Param title)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlTitle: OPWORD $A95F
- ELSE
- IMPORT_CFM_FUNCTION SetControlTitle
- ENDIF
-
- ;
- ; pascal void GetControlTitle(ControlRef theControl, Str255 title)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlTitle: OPWORD $A95E
- ELSE
- IMPORT_CFM_FUNCTION GetControlTitle
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL VALUE, MIMIMUM, AND MAXIMUM API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal SInt16 GetControlValue(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlValue: OPWORD $A960
- ELSE
- IMPORT_CFM_FUNCTION GetControlValue
- ENDIF
-
- ;
- ; pascal void SetControlValue(ControlRef theControl, SInt16 newValue)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlValue: OPWORD $A963
- ELSE
- IMPORT_CFM_FUNCTION SetControlValue
- ENDIF
-
- ;
- ; pascal SInt16 GetControlMinimum(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlMinimum: OPWORD $A961
- ELSE
- IMPORT_CFM_FUNCTION GetControlMinimum
- ENDIF
-
- ;
- ; pascal void SetControlMinimum(ControlRef theControl, SInt16 newMinimum)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlMinimum: OPWORD $A964
- ELSE
- IMPORT_CFM_FUNCTION SetControlMinimum
- ENDIF
-
- ;
- ; pascal SInt16 GetControlMaximum(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlMaximum: OPWORD $A962
- ELSE
- IMPORT_CFM_FUNCTION GetControlMaximum
- ENDIF
-
- ;
- ; pascal void SetControlMaximum(ControlRef theControl, SInt16 newMaximum)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlMaximum: OPWORD $A965
- ELSE
- IMPORT_CFM_FUNCTION SetControlMaximum
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL VARIANT AND WINDOW INFORMATION API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal SInt16 GetControlVariant(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlVariant: OPWORD $A809
- ELSE
- IMPORT_CFM_FUNCTION GetControlVariant
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL ACTION PROC API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal void SetControlAction(ControlRef theControl, ControlActionUPP actionProc)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlAction: OPWORD $A96B
- ELSE
- IMPORT_CFM_FUNCTION SetControlAction
- ENDIF
-
- ;
- ; pascal ControlActionUPP GetControlAction(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlAction: OPWORD $A96A
- ELSE
- IMPORT_CFM_FUNCTION GetControlAction
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONTROL ACCESSOR API'S
- ;
- ;_________________________________________________________________________________________________________
- ;
- ; pascal void SetControlReference(ControlRef theControl, SInt32 data)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlReference: OPWORD $A95B
- ELSE
- IMPORT_CFM_FUNCTION SetControlReference
- ENDIF
-
- ;
- ; pascal SInt32 GetControlReference(ControlRef theControl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetControlReference: OPWORD $A95A
- ELSE
- IMPORT_CFM_FUNCTION GetControlReference
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • PREPARE FOR THE COPLAND MACINTOSH OS NOW
- ;
- ; The window control list is moving to the Control Manager. In addition, to prepare for Copland, you
- ; want to try to begin compiling with STRICT_CONTROLS and STRICT_WINDOWS turned on. This makes the
- ; ControlRecord and WindowRecord opaque and you will be unable to access the fields directly. If you
- ; need information from one of these fields, use one of the provided accessor functions. For now,
- ; the new accessor functions are provided as macros, but in Copland they will become true API entry
- ; points.
- ;
- ; So what does this all mean? Replace all references to the window control list in the WindowRecord
- ; with the macro below. Then in the future when Copland interfaces are available, no source changes
- ; will be required and the macro will automatically replaced with a call to the real API.
- ;
- ; Please direct all questions regarding usuage to the TOOLBOX AppleLink address.
- ;
- ; <<<< See Windows.h for more information >>>>>
- ;
- ;_________________________________________________________________________________________________________
- IF ¬ STRICT_CONTROLS THEN
- ;
- ; pascal Boolean GetAuxiliaryControlRecord(ControlRef theControl, AuxCtlHandle *acHndl)
- ;
- IF ¬ GENERATINGCFM THEN
- _GetAuxiliaryControlRecord: OPWORD $AA44
- ELSE
- IMPORT_CFM_FUNCTION GetAuxiliaryControlRecord
- ENDIF
-
- ENDIF
- ;
- ; pascal void SetControlColor(ControlRef theControl, CCTabHandle newColorTable)
- ;
- IF ¬ GENERATINGCFM THEN
- _SetControlColor: OPWORD $AA43
- ELSE
- IMPORT_CFM_FUNCTION SetControlColor
- ENDIF
-
- ;_________________________________________________________________________________________________________
- ;
- ; • VALID 'CDEF' MESSAGES
- ;
- ;_________________________________________________________________________________________________________
- ; typedef SInt16 ControlDefProcMessage
-
- drawCntl EQU 0
- testCntl EQU 1
- calcCRgns EQU 2
- initCntl EQU 3
- dispCntl EQU 4
- posCntl EQU 5
- thumbCntl EQU 6
- dragCntl EQU 7
- autoTrack EQU 8
- calcCntlRgn EQU 10
- calcThumbRgn EQU 11
- drawThumbOutline EQU 12
-
- ;_________________________________________________________________________________________________________
- ;
- ; • MAIN ENTRY POINT FOR 'CDEF'
- ;
- ;_________________________________________________________________________________________________________
- ;_________________________________________________________________________________________________________
- ;
- ; • CONSTANTS FOR DRAWCNTL MESSAGE PASSED IN PARAM
- ;
- ;_________________________________________________________________________________________________________
- kDrawControlEntireControl EQU 0
- kDrawControlIndicatorOnly EQU 129
-
- ;_________________________________________________________________________________________________________
- ;
- ; • CONSTANTS FOR DRAGCNTL MESSAGE PASSED IN PARAM
- ;
- ;_________________________________________________________________________________________________________
- kDragControlEntireControl EQU 0
- kDragControlIndicator EQU 1
-
- ;_________________________________________________________________________________________________________
- ;
- ; • DRAG CONSTRAINT STRUCTURE PASSED IN PARAM FOR THUMBCNTL MESSAGE (IM I-332)
- ;
- ;_________________________________________________________________________________________________________
- IndicatorDragConstraint RECORD 0
- limitRect ds Rect ; offset: $0 (0)
- slopRect ds Rect ; offset: $8 (8)
- axis ds.w 1 ; offset: $10 (16)
- sizeof EQU * ; size: $12 (18)
- ENDR
-
- ; typedef struct IndicatorDragConstraint IndicatorDragConstraint
- ; typedef IndicatorDragConstraint *IndicatorDragConstraintPtr, **IndicatorDragConstraintHandle
- ;_________________________________________________________________________________________________________
- ;
- ; • OLD ROUTINE NAMES
- ;
- ; These are provided for compatiblity with older source bases. It is recommended to not use them since
- ; they may removed from this interface file at any time.
- ;
- ;_________________________________________________________________________________________________________
- IF OLDROUTINENAMES THEN
-
- useWFont EQU 8
-
- inLabel EQU 1
- inMenu EQU 2
- inTriangle EQU 4
- inButton EQU 10
- inCheckBox EQU 11
- inUpButton EQU 20
- inDownButton EQU 21
- inPageUp EQU 22
- inPageDown EQU 23
- inThumb EQU 129
-
- kNoHiliteControlPart EQU 0
- kInLabelControlPart EQU 1
- kInMenuControlPart EQU 2
- kInTriangleControlPart EQU 4
- kInButtonControlPart EQU 10
- kInCheckBoxControlPart EQU 11
- kInUpButtonControlPart EQU 20
- kInDownButtonControlPart EQU 21
- kInPageUpControlPart EQU 22
- kInPageDownControlPart EQU 23
- kInIndicatorControlPart EQU 129
- kReservedControlPart EQU 254
- kControlInactiveControlPart EQU 255
-
- ENDIF
- ENDIF ; __CONTROLS__
-